<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="page" uri="/WEB-INF/page"%>
<%@page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <link href="${pageContext.request.contextPath}/static/assets/css/bootstrap.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/font-awesome.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/custom-styles.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
</head>
<body>
    <div id="wrapper">
        <div id="page-wrapper" >
          	<div id="page-inner">
			 	<div class="row">
                    <div class="col-md-12">
                        <h1 class="page-header">
                           Order <small>management</small>
                        </h1>
                    </div>
              	</div> 
            	<div class="row">
                	<div class="col-md-12">
                    	<div class="panel panel-default">
                        	<div class="panel-heading">
                             		订单信息
                        	</div>
		              		<form action="order" method="post" id="queryForm">
                        	<div>
                       			<p>
                       				<span>订单号：</span><span><input type="text" name="orderCode" value="${dto.orderCode }"/></span>
                       				<span>乘客昵称：<input type="text" name="userNickname" value="${dto.userNickname }" /></span>
                       				<span>司机昵称：<input type="text"  name="driverNickname" value="${dto.driverNickname }" /></span>
                       				<span>订单状态：
	                  					<select  name="state">
	                   					    <option value = ""> </option>
	                   						<option value = "1" <c:out value="${dto.state == '1' ? 'selected' : ''} "></c:out>>待接单</option>
	                   						<option value = "2" <c:out value="${dto.state == '2' ? 'selected' : ''} "></c:out>>待支付</option>
	                   						<option value = "3" <c:out value="${dto.state == '3' ? 'selected' : ''} "></c:out>>已支付</option> 
	                   						<option value = "4" <c:out value="${dto.state == '4' ? 'selected' : ''} "></c:out>>出行中</option>
	                   						<option value = "5" <c:out value="${dto.state == '5' ? 'selected' : ''} "></c:out>>待评价</option>
	                   						<option value = "6" <c:out value="${dto.state == '6' ? 'selected' : ''} "></c:out>>已完成</option>
	                   						<option value = "7" <c:out value="${dto.state == '7' ? 'selected' : ''} "></c:out>>订单取消</option>
	                   						<option value = "8" <c:out value="${dto.state == '8' ? 'selected' : ''} "></c:out>>订单失效</option>                  				                  				                 				
	                    				</select>
                    				</span>      
                       				<!-- <select  name="state" >
                    					            <option value = ""> </option>
                    								<option value = "1">待接单</option>
                    								<option value = "2">待支付</option>
                    								<option value = "3">已支付</option>
                    								<option value = "4">出行中</option>
                    								<option value = "5">待评价</option>
                    								<option value = "6">已完成</option>
                    								<option value = "7">订单取消</option>
                    								<option value = "8">订单失效</option>
                    							  </select></span>  --> 
                       				<%-- <span>订单状态：<input type="text"  name="state" value="${dto.state }" /></span> --%>
                       				<input type="button" value="查询" onclick="setPageNo(1)">
                       				<input type="reset" value="重置">
                       			</p>
                        	</div>
                        	 <shiro:hasPermission name="order:create"> 	
    							<a href="${pageContext.request.contextPath}/order/create">新增订单</a><br/>
						 	</shiro:hasPermission>
                      		<div class="panel-body">
                            	<div class="table-responsive">
                                	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
	                                    <thead>
	                                        <tr>
	                                            <th>订单号</th>
	                                            <th>乘客昵称</th>
	                                            <th>司机昵称</th>
	                                            <th>出发地</th>
	                                            <th>目的地</th>
	                                            <th>出发时间</th>
	                                            <th>价格</th>
	                                           <!--  <th>折扣</th>
	                                            <th>实际折扣后价格</th> -->
<!-- 	                                            <th>是否免单</th> -->
	                                            <th>订单状态</th>
	                                            <!-- <th>视频审核状态</th> -->
	                                        </tr>
	                                    </thead>
                                    	<tbody>
		                                    <c:forEach items="${page.results}" var="order">
		                                        <tr class="odd gradeX">
		                                            <td class="center"><a href="${pageContext.request.contextPath}/order/${order.id}/update">${order.orderCode}</a></td>
		                                            <td><a href="${pageContext.request.contextPath}/appuser/${order.passengerCode}">${order.userNickname}</a></td>
		                                            <td><a href="${pageContext.request.contextPath}/appuser/${order.driverCode}">${order.driverNickname }</a></td>
		                                            <td>${order.baseAddress }</td>
		                                            <td>${order.destination }</td>
		                                            <td>
		                                            	<fmt:formatDate value="${order.bespeakTime }" pattern="yyyy-MM-dd HH:mm"/>
		                                            </td>
		                                            <td>${order.price }</td>
		                                           <%--  <td>${order.discount }</td>
		                                            <td>${order.actualPrice }</td> --%>
		                                            <td>
		                                            	<c:choose>
		                                            		<c:when test="${order.state == 1 }">
		                                            			待接单
		                                            		</c:when>
		                                            		<c:when test="${order.state == 2 }">
		                                            			待支付
		                                            		</c:when>
		                                            		<c:when test="${order.state == 3 }">
		                                            			已支付
		                                            		</c:when>
		                                            		<c:when test="${order.state == 4 }">
		                                            			出行中
		                                            		</c:when>
		                                            		<c:when test="${order.state == 5 }">
		                                            			待评价
		                                            		</c:when>
		                                            		<c:when test="${order.state == 6 }">
		                                            			已完成
		                                            		</c:when>
		                                            		<c:when test="${order.state == 7 }">
		                                            			订单取消
		                                            		</c:when>
		                                            		<c:when test="${order.state == 8 }">
		                                            			订单失效
		                                            		</c:when>
		                                            		<c:otherwise>
		                                
		                                            		</c:otherwise>
		                                            	</c:choose>
		                                            </td>
		        								 <%--<td><c:choose>
		                                            	<c:when test="${order.videoState == 0 }">
		                                            		未审核
		                                            	</c:when>
		                                            	<c:when test="${order.videoState == 1 }">
		                                            		已审核
		                                            	</c:when>
		                                            		<c:otherwise>
		                                
		                                            		</c:otherwise>	
		                                            </c:choose></td> --%>		                                    
		                                        </tr>
		                                     </c:forEach>
                                    	</tbody>
                                	</table>
                            	</div>
                        	</div>
		                   	<p align="right"><page:page page="${page }"/></p>
		               		</form>
                    	</div>
                	</div>
				</div>
        	</div>
	    </div>
	</div>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery-1.10.2.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/custom-scripts.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/page.js"></script>
    <script>
          $(document).ready(function () {

          });
  	</script>
</body>
</html>
